package com.example.demo.mapper;

import com.example.demo.entity.Userinfo;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Fyly
 * @since 2019-02-28
 */
public interface UserinfoMapper extends BaseMapper<Userinfo> {

    @Select("SELECT  * from  userinfo  WHERE userId = #{userId}")
    Userinfo selectByUserInfo(@Param("userId") int userId);

    @Update("UPDATE userinfo SET lon = #{lon} ,lat= #{lat} WHERE userId = #{userId} ")
    Userinfo updatePosition(@Param("userId") int userId,@Param("lon") float lon,@Param("lat")float lat);

    @Select("select * from userinfo where userId !=#{userId}")
    List<Userinfo> selectPositions(@Param("userId") int userId);

}
